
#include<iostream>//多继承

class UltraBase
{
public:
    UltraBase(int c):c(c){};
protected:
    int c;
};

class Base1:virtual public UltraBase
{
public:
    Base1(int a,int c):UltraBase(c),a(a){std::cout<<"Base1\n";}
    void show()
    {
        std::cout<<"a."<<a<<std::endl;
    }
    
protected:
    int a;
};

class Base2:virtual public UltraBase
{
public:
    Base2(int c,int b):UltraBase(c),b(b){std::cout<<"Base2\n";}
    void show()
    {
        std::cout<<"b."<<b<<std::endl;
    }
protected:
    int b;
};

//父类构建顺序和构造函数调用顺序没关系，和继承顺序有关
class Derived:public Base1,public Base2
{
public:
    Derived(int a,int b,int c):UltraBase(c),Base1(c,a),Base2(c,b)
    {
        this->Base1::c++;
    }
    void show()
    {
        Base1:show();
        Base2:show();
        std::cout<<"c."<<c<<std::endl;
    }
protected:
};



int main ()
{
    Derived d(1,2,3);
    return 0;
}